package com.daocao.auth.controller;

import org.springframework.web.bind.annotation.RestController;

import com.daocao.common.domain.dto.LoginDto;
import com.daocao.common.service.IAuthService;
import com.daocao.common.response.DaoCaoResult;

import lombok.extern.slf4j.Slf4j;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;



@RestController
@RequestMapping("auth")
@Slf4j
public class AuthController {

    @Autowired
    private IAuthService authService;

    /**
     * 系统用户登录
     * @param loginDto
     * @return
     */
    @PostMapping("sys")    
    public DaoCaoResult sysLogin(@RequestBody LoginDto loginDto){
        log.info("loginDto=========>{}",loginDto);
        String token = authService.login(loginDto);
        return DaoCaoResult.success().put("token", token);
    }
    
}
